// 2、属性装饰器
// 属性装饰器表达式会在运行时当做函数被调用，传入下列2个参数
// 1、对于静态成员来说是类的构造函数，对于实例成员是类的原型对象
// 2、成员的名字
namespace plog {
  // 类装饰器
  function logClass(params: string) {
    return function (target: any) {
      console.log(target);
      console.log(params);
    }
  }
  function logProperty(params: any) {
    return function (target: any, attr: any) {
      console.log(target);
      console.log(attr);
      target[attr] = params;
    }
  }
  @logClass('xxxx')
  class HttpClient {
    @logProperty('http://itying.com')
    public url: any | undefined;
    constructor() {

    }
    getData() {
      console.log(this.url);
    }
  }
  var http = new HttpClient();
  http.getData();

}


